<!DOCTYPE html>
<html lang="zh"xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>首页 - 天才(genius)后台管理系统</title>
<link rel="icon" th:href="@{favicon.ico}" type="image/ico">
  <link href="css/bootstrap.min.css" th:href="@{~/css/bootstrap.min.css}" rel="stylesheet">
  <link href="css/materialdesignicons.min.css" th:href="@{~/css/materialdesignicons.min.css}" rel="stylesheet">
  <link href="css/style.min.css" th:href="@{~/css/style.min.css}" rel="stylesheet">

</head>

<body>
<div class="lyear-layout-web">
  <div class="lyear-layout-container">
    <!--左侧导航-->
    <aside th:include="left::common" class="lyear-layout-sidebar">
    </aside>
    <!--End 左侧导航-->
    <!--头部信息-->
    <header th:include="head :: common" class="lyear-layout-header">
    </header>
    <!--End 头部信息-->
    <!--页面主要内容-->
    <main class="lyear-layout-content">
      <div class="col-md-12">
        <div class="card">
          <div class="card-header"><h4>试题添加</h4></div>
          <div class="card-body">
            <ul class="nav nav-tabs nav-justified">
              <li class="active">
                <a data-toggle="tab" href="#home-basic">单选</a>
              </li>
              <li class="nav-item">
                <a data-toggle="tab" href="#profile-basic">多选</a>
              </li>
              <li class="nav-item">
                <a data-toggle="tab" href="#messages-basic">简答</a>
              </li>

            </ul>
            <div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
              <div class="modal-dialog modal-sm" role="document">
                <div class="modal-content">
                  <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                    <h4 class="modal-title" id="myLargeModalLabel">部门新增</h4>
                  </div>
                  <div class="modal-body">
                    是否确认添加😊
                  </div>
                  <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" onclick="add()" class="btn btn-primary">点击保存</button>
                  </div>
                </div>
              </div>
            </div>
            <div class="tab-content">
              <div class="tab-pane fade active in" id="home-basic">
                <form action="/study-test-questions-one/save" method="post" class="row">
                  <div class="form-group col-md-6">
                    <label >创建人</label>
                    <input type="hidden" name="testQuestionsOneCreateEmpId" th:value="${session.USER.id}">
                    <input type="text" disabled="disabled"  class="form-control" th:value="${session.USER.empName}"/>
                  </div>
                  <div class="form-group col-md-12">
                    <label >题目</label>
                 <textarea class="form-control" th:onblur="saveone()" onblur="saveone()" id="testQuestionsOneOpic" name="testQuestionsOneOpic" rows="5" placeholder="请输入题目"></textarea>
                  </div>

                  <div class="form-group col-md-12">
                    <label >选项A</label>
                    <input type="text" class="form-control" th:onblur="saveone()" onblur="saveone()" id="testQuestionsOneOptiona" name="testQuestionsOneOptiona" placeholder="请输入选项A" />
                  </div>

                  <div class="form-group col-md-12">
                    <label >选项B</label>
                    <input type="text" class="form-control" th:onblur="saveone()" onblur="saveone()" id="testQuestionsOneOptionb"  name="testQuestionsOneOptionb"  placeholder="请输入选项B" />
                  </div>

                  <div class="form-group col-md-12">
                    <label >选项C</label>
                    <input type="text" class="form-control" th:onblur="saveone()" onblur="saveone()" id="testQuestionsOneOptionc" name="testQuestionsOneOptionc" placeholder="请输入选项C" />
                  </div>

                  <div class="form-group col-md-12">
                    <label >选项D</label>
                    <input type="text" class="form-control" th:onblur="saveone()" onblur="saveone()" id="testQuestionsOneOptiond" name="testQuestionsOneOptiond"  placeholder="请输入选项D" />
                  </div>
                  <div class="form-group col-md-12">
                    <label for="type">正确答案</label>
                    <div class="form-controls">
                      <select name="testQuestionsOneAnswer" th:onblur="saveone()" onblur="saveone()"  class="form-control" id="type">
                        <option value="A">A</option>
                        <option value="B">B</option>
                        <option value="C">C</option>
                        <option value="D">D</option>
                      </select>
                    </div>
                  </div>
                  <div class="form-group col-md-12">
                    <label for="type">该题属于哪个部门</label>
                    <div class="form-controls">
                      <select th:onblur="saveone()" onblur="saveone()" id="testQuestionsOneDepId" name="testQuestionsOneDepId" class="form-control">
                        <option value="">请选择</option>
                        <option th:each="dep : ${deplist}" th:value="${dep.id}">[[${dep.depName}]]</option>
                      </select>
                    </div>
                  </div>
                  <div class="form-group col-md-12">
                    <div class="form-group col-md-12 alert alert-danger" role="alert"  hidden="hidden" id="msgone"></div>
                    <button type="submit" disabled="disabled" class="btn btn-primary ajax-post" id="butone" target-form="add-form">保存</button>
                    <button type="button" class="btn btn-default" onclick="javascript:history.back(-1);return false;">返 回</button>
                  </div>
                </form>
              </div>
              <div class="tab-pane fade" id="profile-basic">
                <form action="/study-test-questions-more/save" method="post" class="row">
                  <div class="form-group col-md-6">
                    <label >创建人</label>
                    <input type="hidden" id="testQuestionsMoreCreateEmpId" name="testQuestionsMoreCreateEmpId" th:value="${session.USER.id}">
                    <input type="text" disabled="disabled" class="form-control" th:value="${session.USER.empName}"/>
                  </div>
                  <div class="form-group col-md-12">
                    <label>题目</label>
                    <textarea id="testQuestionsMoreOpic" onblur="savemore()" class="form-control" name="testQuestionsMoreOpic" rows="5"  placeholder="请输入题目"></textarea>
                  </div>

                  <div class="form-group col-md-12">
                    <label >选项A</label>
                    <input type="text" class="form-control" onblur="savemore()" id="testQuestionsMoreOptiona"   name="testQuestionsMoreOptiona" placeholder="请输入选项A" />
                  </div>

                  <div class="form-group col-md-12">
                    <label >选项B</label>
                    <input type="text" class="form-control" onblur="savemore()" id="testQuestionsMoreOptionb"  name="testQuestionsMoreOptionb" placeholder="请输入选项B" />
                  </div>

                  <div class="form-group col-md-12">
                    <label >选项C</label>
                    <input type="text" class="form-control" onblur="savemore()"  id="testQuestionsMoreOptionc" name="testQuestionsMoreOptionc"placeholder="请输入选项C" />
                  </div>

                  <div class="form-group col-md-12">
                    <label >选项D</label>
                    <input type="text" class="form-control" onblur="savemore()" id="testQuestionsMoreOptiond" name="testQuestionsMoreOptiond" placeholder="请输入选项D" />
                  </div>
                  <div class="form-group col-md-12">
                    <label for="type">正确答案</label>
                    <div class="example-box">
                      <label class="lyear-checkbox checkbox-inline checkbox-primary">
                        <input name="testQuestionsMoreAnswer" onclick="savemore()" value="A" type="checkbox"><span>A</span>
                      </label>
                      <label class="lyear-checkbox checkbox-inline checkbox-primary">
                        <input name="testQuestionsMoreAnswer" onclick="savemore()" value="B" type="checkbox"><span>B</span>
                      </label>
                      <label class="lyear-checkbox checkbox-inline checkbox-primary">
                        <input name="testQuestionsMoreAnswer"onclick="savemore()" value="C" type="checkbox"><span>C</span>
                      </label>
                      <label class="lyear-checkbox checkbox-inline checkbox-primary">
                        <input name="testQuestionsMoreAnswer"onclick="savemore()" value="D" type="checkbox"><span>D</span>
                      </label>
                    </div>
                  </div>
                  <div class="form-group col-md-12">
                    <label for="type">该题属于哪个部门</label>
                    <div class="form-controls">
                      <select name="testQuestionsMoreDepId" class="form-control">
                        <option value="">请选择</option>
                        <option th:each="dep : ${deplist}" th:value="${dep.id}">[[${dep.depName}]]</option>
                      </select>
                    </div>
                  </div>
                  <div class="form-group col-md-12">
                    <div class="form-group col-md-12 alert alert-danger" role="alert"  hidden="hidden" id="msgmore"></div>
                    <button type="submit" class="btn btn-primary ajax-post" id="butmore" disabled="disabled" target-form="add-form">确 定</button>
                    <button type="button" class="btn btn-default" onclick="javascript:history.back(-1);return false;">返 回</button>
                  </div>
                </form>
              </div>
              <div class="tab-pane fade" id="messages-basic">
                <form action="/study-test-questions-shortanswer/save" method="post" class="row">
                  <div class="form-group col-md-6">
                    <label >创建人</label>
                    <input type="hidden" name="testQuestionsShortanswerCreateEmpId" th:value="${session.USER.id}">
                    <input type="text" disabled="disabled" class="form-control" th:value="${session.USER.empName}"/>
                  </div>
                  <div class="form-group col-md-12">
                    <label>题目</label>
                    <textarea class="form-control" onblur="saveshort()" id="testQuestionsShortanswerOpic" name="testQuestionsShortanswerOpic" rows="5"  placeholder="请输入题目"></textarea>
                  </div>
                  <div class="form-group col-md-12">
                    <label>参考答案(可选填)</label>
                    <textarea class="form-control"  name="testQuestionsShortanswerAnswer" rows="5"  placeholder="请输入答案"></textarea>
                  </div>
                  <div class="form-group col-md-12">
                    <label for="type">该题属于哪个部门</label>
                    <div class="form-controls">
                      <select name="testQuestionsShortanswerDepId" class="form-control">
                        <option value="">请选择</option>
                        <option th:each="dep : ${deplist}" th:value="${dep.id}">[[${dep.depName}]]</option>
                      </select>
                    </div>
                  </div>
                  <div class="form-group col-md-12">
                    <div class="form-group col-md-12 alert alert-danger" role="alert"  hidden="hidden" id="msgshore"></div>
                    <button type="submit" disabled="disabled" id="butshort" class="btn btn-primary ajax-post" target-form="add-form">确 定</button>
                    <button type="button" class="btn btn-default" onclick="javascript:history.back(-1);return false;">返 回</button>
                  </div>
                </form>
              </div>
            </div>
          </div>
        </div>
      </div>
    </main>
    <!--End 页面主要内容-->
  </div>
</div>

<script type="text/javascript" th:src="@{~/js/jquery.min.js}" src="js/jquery.min.js"></script>
<script type="text/javascript" th:src="@{~/js/bootstrap.min.js}" src="js/bootstrap.min.js"></script>
<script type="text/javascript" th:src="@{~/js/perfect-scrollbar.min.js}" src="js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" th:src="@{~/js/main.min.js}" src="js/main.min.js"></script>

<!--图表插件-->
<script type="text/javascript" th:src="@{~/js/Chart.js}" src="js/Chart.js"></script>
<script type="text/javascript">

  function saveone() {
    $("#butone").attr({"disabled":"disabled"});
    var testQuestionsOneOpic =$("#testQuestionsOneOpic").val();
    var testQuestionsOneOptiona=$("#testQuestionsOneOptiona").val();
    var testQuestionsOneOptionb=$("#testQuestionsOneOptionb").val();
    var testQuestionsOneOptionc=$("#testQuestionsOneOptionc").val();
    var testQuestionsOneOptiond=$("#testQuestionsOneOptiond").val();
    if(testQuestionsOneOpic===""){
      $("#msgone").html("请输入题目").show();
      setTimeout(function () {
        $("#msgone").hide();
      }, 3000);
      return
    }else if(testQuestionsOneOptiona==""){
        $("#msgone").html("请输入选项A").show();
        setTimeout(function () {
          $("#msgone").hide();
        }, 3000);
      return
    }else if(testQuestionsOneOptionb==""||testQuestionsOneOptionb==undefined){
        $("#msgone").html("请输入选项B").show();
        setTimeout(function () {
          $("#msgone").hide();
        }, 3000);
      return
    }else if(testQuestionsOneOptionc==""||testQuestionsOneOptionc==undefined){

        $("#msgone").html("请输入选项C").show();
        setTimeout(function () {
          $("#msgone").hide();
        }, 3000);

      return
    }else if(testQuestionsOneOptiond==""||testQuestionsOneOptiond===undefined){

        $("#msgone").html("请输入选项D").show();
        setTimeout(function () {
          $("#msgone").hide();
        }, 3000);

      return
    }
    $("#butone").removeAttr("disabled");
  }
  function savemore() {
    $("#butmore").attr({"disabled":"disabled"});
    var testQuestionsMoreOpic =$("#testQuestionsMoreOpic").val();
    var testQuestionsMoreOptiona=$("#testQuestionsMoreOptiona").val();
    var testQuestionsMoreOptionb=$("#testQuestionsMoreOptionb").val();
    var testQuestionsMoreOptiond=$("#testQuestionsMoreOptiond").val();
    var testQuestionsMoreOptionc=$("#testQuestionsMoreOptionc").val();
    var textbox=document.getElementsByName('testQuestionsMoreAnswer');



    if(testQuestionsMoreOpic===""){
      $("#msgmore").html("请输入题目").show();
      setTimeout(function () {
        $("#msgmore").hide();
      }, 3000);
      return
    }else if(testQuestionsMoreOptiona==""){
      $("#msgmore").html("请输入选项A").show();
      setTimeout(function () {
        $("#msgmore").hide();
      }, 3000);
      return
    }else if(testQuestionsMoreOptionb==""||testQuestionsMoreOptionb==undefined){
      $("#msgmore").html("请输入选项B").show();
      setTimeout(function () {
        $("#msgmore").hide();
      }, 3000);
      return
    }else if(testQuestionsMoreOptionc==""||testQuestionsMoreOptionc==undefined){
      $("#msgmore").html("请输入选项C").show();
      setTimeout(function () {
        $("#msgmore").hide();
      }, 3000);

      return
    }else if(testQuestionsMoreOptiond==""||testQuestionsMoreOptiond===undefined){
      $("#msgmore").html("请输入选项D").show();
      setTimeout(function () {
        $("#msgmore").hide();
      }, 3000);

      return
    }
    var rylist='';
    var qxs = textbox;
    for(var i=0;i<qxs.length;i++){
      if(qxs[i].checked){
        rylist+=qxs[i].value+",";
      }
    }
    if(rylist == '' || rylist == null){
      $("#msgmore").html("请至少选择一个答案").show();
      setTimeout(function () {
        $("#msgmore").hide();
      }, 3000);
      return
    }
    $("#butmore").removeAttr("disabled");
  }
  function saveshort(){
    $("#butshort").attr({"disabled":"disabled"});
    var testQuestionsShortanswerOpic =$("#testQuestionsShortanswerOpic").val();
    if(testQuestionsShortanswerOpic===""){
      $("#msgshore").html("请输入题目").show();
      setTimeout(function () {
        $("#msgshore").hide();
      }, 3000);
      return
    }
    $("#butshort").removeAttr("disabled");
  }
/*
$(document).keydown(function(){
    let  val =  $(testQuestionsOneOpic).val();
    console.log(val)
})
*/


$(document).ready(function(e) {
    var $dashChartBarsCnt  = jQuery( '.js-chartjs-bars' )[0].getContext( '2d' ),
        $dashChartLinesCnt = jQuery( '.js-chartjs-lines' )[0].getContext( '2d' );

    var $dashChartBarsData = {
		labels: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
		datasets: [
			{
				label: '注册用户',
                borderWidth: 1,
                borderColor: 'rgba(0,0,0,0)',
				backgroundColor: 'rgba(51,202,185,0.5)',
                hoverBackgroundColor: "rgba(51,202,185,0.7)",
                hoverBorderColor: "rgba(0,0,0,0)",
				data: [2500, 1500, 1200, 3200, 4800, 3500, 1500]
			}
		]
	};
    var $dashChartLinesData = {
		labels: ['2003', '2004', '2005', '2006', '2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014'],
		datasets: [
			{
				label: '交易资金',
				data: [20, 25, 40, 30, 45, 40, 55, 40, 48, 40, 42, 50],
				borderColor: '#358ed7',
				backgroundColor: 'rgba(53, 142, 215, 0.175)',
                borderWidth: 1,
                fill: false,
                lineTension: 0.5
			}
		]
	};

    new Chart($dashChartBarsCnt, {
        type: 'bar',
        data: $dashChartBarsData
    });

    var myLineChart = new Chart($dashChartLinesCnt, {
        type: 'line',
        data: $dashChartLinesData,
    });
});
</script>
</body>
</html>